package com.example.controller;


import com.example.entity.User;
import com.example.service.UploadService;
import com.example.service.UserService;
import com.example.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping()
public class IndexController {
    @Autowired
    private UserService userService;

    @Autowired
    private UploadService uploadService;

//    @GetMapping("/getInfo")
//    public ResponseResult getInfo(){
//        return userService.userInfo();
//    }



    @PostMapping("/login")
    public ResponseResult login(@RequestBody User user){
        return userService.login(user);
    }

    @PostMapping ("/logout")
    public ResponseResult logout(){
        return ResponseResult.okResult();
    }

    @PostMapping("/upload")
    public ResponseResult uploadImg(MultipartFile img){
        return uploadService.uploadImg(img);
    }


}
